package com.entmanage.base.collegeco.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.entmanage.common.annotation.Log;
import com.entmanage.common.core.controller.BaseController;
import com.entmanage.common.core.domain.AjaxResult;
import com.entmanage.common.enums.BusinessType;
import com.entmanage.base.collegeco.domain.CollegecoInternReport;
import com.entmanage.base.collegeco.service.ICollegecoInternReportService;
import com.entmanage.common.utils.poi.ExcelUtil;
import com.entmanage.common.core.page.TableDataInfo;

/**
 * 实习报告Controller
 *
 * @author lsq
 * @date 2025-08-06
 */
@Api(tags = {"collegeco-CollegecoInternReport模块"}, description = "实习报告")
@RestController
@RequestMapping("/collegeco/report")
public class CollegecoInternReportController extends BaseController
{
    @Autowired
    private ICollegecoInternReportService collegecoInternReportService;

    /**
     * 查询实习报告列表
     */
    @PreAuthorize("@ss.hasPermi('collegeco:report:list')")
    @GetMapping("/list")
    public TableDataInfo list(CollegecoInternReport collegecoInternReport)
    {
        startPage();
        List<CollegecoInternReport> list = collegecoInternReportService.selectCollegecoInternReportList(collegecoInternReport);
        return getDataTable(list);
    }

    /**
     * 导出实习报告列表
     */
    @PreAuthorize("@ss.hasPermi('collegeco:report:export')")
    @Log(title = "实习报告", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CollegecoInternReport collegecoInternReport)
    {
        List<CollegecoInternReport> list = collegecoInternReportService.selectCollegecoInternReportList(collegecoInternReport);
        ExcelUtil<CollegecoInternReport> util = new ExcelUtil<CollegecoInternReport>(CollegecoInternReport.class);
        util.exportExcel(response, list, "实习报告数据");
    }

    /**
     * 获取实习报告详细信息
     */
    @PreAuthorize("@ss.hasPermi('collegeco:report:query')")
    @GetMapping(value = "/{reportId}")
    public AjaxResult getInfo(@PathVariable("reportId") Long reportId)
    {
        return success(collegecoInternReportService.selectCollegecoInternReportByReportId(reportId));
    }

    /**
     * 新增实习报告
     */
    @PreAuthorize("@ss.hasPermi('collegeco:report:add')")
    @Log(title = "实习报告", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CollegecoInternReport collegecoInternReport)
    {
        return toAjax(collegecoInternReportService.insertCollegecoInternReport(collegecoInternReport));
    }

    /**
     * 修改实习报告
     */
    @PreAuthorize("@ss.hasPermi('collegeco:report:edit')")
    @Log(title = "实习报告", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CollegecoInternReport collegecoInternReport)
    {
        return toAjax(collegecoInternReportService.updateCollegecoInternReport(collegecoInternReport));
    }

    /**
     * 删除实习报告
     */
    @PreAuthorize("@ss.hasPermi('collegeco:report:remove')")
    @Log(title = "实习报告", businessType = BusinessType.DELETE)
	@DeleteMapping("/{reportIds}")
    public AjaxResult remove(@PathVariable Long[] reportIds)
    {
        return toAjax(collegecoInternReportService.deleteCollegecoInternReportByReportIds(reportIds));
    }
}
